package com.tools.cleanmaster.appinfo;

/**
 * Used to cache some apps info in DB.
 */
public interface IAppsInfoCacheDatabase {
    /**
     * Get APK MD5 from cache DB.
     * @return null if not found in cache DB
     */
    String getApkMd5(String pkgName);

    /**
     * Save APK MD5 into cache DB
     */
    void saveApkMd5(String pkgName, String apkMd5);

    /**
     * Clear APK MD5 in cache DB
     */
    void clearApkMd5(String pkgName);

    /**
     * Get signature digest with BaiduSHA1
     * @return null if not found in cache DB
     */
    String getSignatureBaiduSha1(String pkgName);

    /**
     * Save signature digest with BaiduSHA1 into cache DB
     */
    void saveSignatureBaiduSha1(String pkgName, String signSha1);

    /**
     * Get signature digest with BaiduMD5
     * @return 0 if not found in cache DB
     */
    long getSignatureBaiduMd5(String pkgName);

    /**
     * Save signature digest with BaiduMD5 into cache DB
     */
    void saveSignatureBaiduMd5(String pkgName, long signMd5);

    /**
     * Notify the cache DB when an package removed.</p>
     * Note:</br>
     * The cache DB implementation should delete DB record of the package,
     *  or clear all caches (APK digests & signature digests).</p>
     * @param pkgName
     */
    void onPackageRemoved(String pkgName);
}
